OPC-UA Embedded Server SDK  2.1.0
Configuration and Control Functions

Functions

UA_Status_t UAServer_Initialise (const UA_Configuration_t *config)
 
void UAServer_Terminate (void)
 
UA_Status_t UAServer_Add_IP_address (uint8_t *ip_address)
 
UA_Status_t UAServer_Clear_all_IP_addresses (void)
 
UA_Status_t UAServer_Add_hostname (const char *hostname)
 
UA_Status_t UAServer_Clear_all_hostnames (void)
 
void UAServer_Poll (void)
 
UA_Status_t UAServer_Set_URI (const char *uri)
 
UA_Status_t UAServer_Start (const char *license)
 
UA_Status_t UAServer_Stop (void)
 
UA_Server_state_t UAServer_Get_state (bool_t *shutdown_complete)
 

Detailed Description

Function Documentation

UA_Status_t UAServer_Initialise ( const UA_Configuration_t *  config)

Initialise the library

This function returns OpcUa_Good if no errors are found during initialisation. If security is excluded from the build all errors are unrecoverable and the server will not start. If security is included in the build errors related to the application instance certificate are recoverable and the server will still start.

Specifically:

OpcUa_BadNoValidCertificates. An application instance certificate and private key are not found. The initialisation was successful but a certificate must be created or installed in order to proceed successfully.

OpcUa_BadSecurityChecksFailed. The application instance certificate failed validation for an undetermined reason (it may be corrupted). The initialisation was successful but if a new certificate is not created or installed the server may not interoperate correctly.

OpcUa_BadCertificateTimeInvalid. The application instance certificate failed validation due to an invalid time (it may have expired). The initialisation was successful but if a new certificate is not created or installed the server may not interoperate correctly. Also, operating the server with an expired certificate may be against your stated security policy.

OpcUa_BadCertificateRevoked. The application instance certificate failed validation because it has been revoked or because the CA CRL could not be found offline. The initialisation was successful but if a new certificate is not created or installed the server may not interoperate correctly. Also, operating the server with a revoked certificate may be against your stated security policy. It is possible that this error is generated due to initialising the server with an incorrect option bit configuration. To avoid this initialise the server before setting validation option bits.

Parameters
[in]configThe requested server configuration data structure.
Returns
The result of the operation.
void UAServer_Terminate ( void  )

Terminate the library

Releases all resources allocated by the library. Not required to be called in a typical embedded environment.

UA_Status_t UAServer_Add_IP_address ( uint8_t *  ip_address)

Adds an IP address of a network interface

Where the target device does not have a Hostname, the stack requires the IP Address of the network interface in order to generate URI's and application instance certificates. Up to MAX_IP_ADDRESSES may be added. In general, IPAddresses should NOT be added where a Hostname has already been added.

Parameters
[in]ip_addressA 4-byte long byte array containing the IP Address of the network interface. Example: "192.168.2.1" == { 0xC0, 0xA8, 0x02, 0x01 }
Returns
The result of the operation.
UA_Status_t UAServer_Clear_all_IP_addresses ( void  )

Clears the list of IP addresses

It is possible that when using DHCP, an IP Address may change during server operation. In this case the list of IP addresses must be cleared by calling this function followed immediately by one or more calls to UA_Tcpip_add_IP_address(). It is only required to use this function where the device has no Hostname and is using DHCP for IP Address assignment.

Returns
The result of the operation.
UA_Status_t UAServer_Add_hostname ( const char *  hostname)

Adds a Hostname of the device

Where the target device has a Hostname, the stack requires this name in order to generate URI's and application instance certificates. Up to MAX_HOSTNAMES may be added. IPAddresses should NOT be added where a Hostname has already been added.

Parameters
[in]hostnameA null terminated ANSI C string containing the hostname.
Returns
The result of the operation.
UA_Status_t UAServer_Clear_all_hostnames ( void  )

Clears the list of host names

Host names rarely change. However, should a hostname change during server operation it is required to clear the internal list of names and immediately populate the list with the new name(s) using UA_Tcpip_add_hostname().

Returns
The result of the operation.
void UAServer_Poll ( void  )

Poll library periodically

The library must be polled at the cyclic rate specified in the configuration data structure. No checking is performed internally on timing so the timing behaviour of the server is directly dependent on the accuracy of polling by the application.

UA_Status_t UAServer_Set_URI ( const char *  uri)

Set Server URI

The OPC-UA Server must be given a unique name or Universal Resource Identifier (URI). This name will be cached by clients that regularly connect to the server so for any particular device, the name must be constant. This name can be stored in non-volatile storage as a constant, or alternatively can be calculated dynamically during startup based on the machine MAC address or some other constant, unique value. The URI can be in any format. We recommend using the URN (Uniform Resource Name) UUID (Universally Unique IDentifier) format as follows: "urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66"

Parameters
[in]uriA null terminated ANSI C string containing the URI.
Returns
The result of the operation.
UA_Status_t UAServer_Start ( const char *  license)

Start Server

Must be called in order to start the server.

Parameters
[in]licenseSome distributions require a license string in order to start. If your distribution does not require a license string simply provide a NULL pointer.
Returns
The result of the operation.
UA_Status_t UAServer_Stop ( void  )

Stop Server

Must be called in order to stop the server. Will stop the server immediately if no clients are connected. Will change server status and forcibly disconnect any connected clients after 60 seconds if clients are connected. After stopping the server the application should poll UAServer_get_state to detect when the shutdown is complete. The application can then call UAServer_Terminate to release all resources. A stopped server will refuse all attempts to create new TCP Binary connections.

Returns
The result of the operation.
UA_Server_state_t UAServer_Get_state ( bool_t *  shutdown_complete)

Get Server State

Reads the current server state.

Parameters
[out]shutdown_completeIf the server state is shutdown, the server may be in the process of shutting down. In this state this variable informs the host whether or not the shutdown is complete.
Returns
The result of the operation.